<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class HomeController extends Controller
{
    public function index($value='')
    {
    	//待采集的目标页面，PHPHub教程区
        // $page = 'https://laravel-china.org/categories/6';
        $page = 'http://www.sina.com.cn';
        //采集规则
        $rules = array(
            //文章标题
            'title' => ['li:eq(1) a','text'],
            //文章链接
            //'link' => ['.title-content','href'],
        );
        //列表选择器
        $rang = '.top_newslist ul';
        //采集
        $data = \QL\QueryList::Query($page,$rules,$rang)->data;
        //查看采集结果
        return $data;
    }
}
